<!DOCTYPE html>
<html>

<head></head>

<body></body>
<script type="text/javascript">
    let originalOb = {
        name: "brook",
        age: 42
    }
    let obProxy = new Proxy(originalOb, {
        get(target, propkey, receiver){
            return "proxy name";
        },
        set(target, propkey, value, receiver){
            target.age = value;
        }
    });
    // 无论调用什么属性，都会返回proxy name字符串
    console.log(obProxy.name);
    // 设定33给age
    obProxy.age = 33;
    // 原始对象的age属性变为33
    console.log(originalOb.age);
    // 但是代理对象仍然返回的是proxy name字符串
    console.log(obProxy.age);
</script>

</html>